package com.cims.action;

import java.io.InputStream;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport implements SessionAware,ServletRequestAware,ServletResponseAware{

	private static final long				serialVersionUID	= 1L;

	public static final String				SUCCESS				= "success";
	public static final String				ERROR				= "error";
	public static final String				INPUT				= "input";
	private String							systemError;

	protected HttpServletRequest			request;

	protected SessionMap<String, Object>	sessionmap;

	public Map<String, Object>				session				= ActionContext.getContext().getSession();

	protected InputStream					inputStream;

	public BaseAction(){
	}

	public String list(){
		return SUCCESS;
	}

	public String insert(){
		return SUCCESS;
	}

	public String update(){
		return SUCCESS;
	}

	public String getSystemError(){
		return systemError;
	}

	public void setSystemError(Exception ex, boolean devMode){
		this.systemError = ExceptionUtils.getStackTrace(ex);
	}

	public SessionMap<String, Object> getSessionmap(){
		return sessionmap;
	}

	public void setSessionmap(SessionMap<String, Object> sessionmap){
		this.sessionmap = sessionmap;
	}

	public InputStream getInputStream(){
		return inputStream;
	}

	public void setInputStream(InputStream inputStream){
		this.inputStream = inputStream;
	}

	public HttpServletRequest getRequest(){
		return request;
	}

	public void setRequest(HttpServletRequest request){
		this.request = request;
	}

	@Override
	public void setServletResponse(HttpServletResponse arg0){

	}

	@Override
	public void setServletRequest(HttpServletRequest arg0){

	}

	@Override
	public void setSession(Map<String, Object> arg0){
		// TODO Auto-generated method stub

	}
}
